package com.test2;

import org.openqa.selenium.edge.EdgeOptions;
import org.openqa.selenium.remote.RemoteWebDriver;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.Map;

public class ScriptTestFirefoxRemote {

    public static void main(String[] args) throws MalformedURLException {
        String path = "C:\\Program Files\\Mozilla Firefox\\geckodriver.exe";
        if(args.length > 0){
            path = args[0];
        }
        get("http://www.baidu.com/",path);
    }

    public static Map<String, String> get(String url,String path) throws MalformedURLException {
        // 参数配置
        //System.setProperty("webdriver.gecko.driver", path);
        EdgeOptions option = new EdgeOptions();
        //1option.setCapability("browserName", "msedge");
//        option.setCapability("platformName", "Windows 11");
//// Showing a test name instead of the session id in the Grid UI
//        option.setCapability("se:name", "My simple test");
//// Other type of metadata can be seen in the Grid UI by clicking on the
//// session info or via GraphQL
//        option.setCapability("se:sampleMetadata", "Sample metadata value");

        RemoteWebDriver  driver =  new RemoteWebDriver(new URL("http://127.0.0.1:4444"),option);
//        driver.manage().window().maximize();
//        driver.manage().deleteAllCookies();
//        driver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS);
//        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
        // 创建EventFiringWebDriver 实例
        // Register the Listener with the event firing driver
        driver.get(url);



        return null;
    }
}

